package com.heima.showWhatTheIOC.servlet;

import com.heima.showWhatTheIOC.service.HelloService;
import com.heima.showWhatTheIOC.service.Impl.HelloServiceImpl;

import java.lang.reflect.InvocationTargetException;

/**
 * @Author: Ethan Yankang
 * @Program: SpringBilibili
 * @Date: 2024-09-01 14:34
 **/
/*
 * @description 手写一个Servlet，重写一个doGet()方法
 * @params
 * @return
 */


//@WebServlet("/hello")
//
//public class HelloServlet extends HttpServlet {
//    private final HelloService helloService=new HelloServiceImpl();
//
//    public HelloServlet() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
//    }
//
//    @Override
//    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws  IOException {
//        resp.getWriter().write(this.helloService.findAll().toString());
//
//    }
//}


//@WebServlet("/hello")

public class HelloServlet  {
    private HelloService helloService=new HelloServiceImpl();

    public HelloServlet() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
    }

    public static void main(String[] args) throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
        HelloServlet helloServlet = new HelloServlet();
        System.out.println(helloServlet.helloService.findAll());
    }
}
